<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>全局组件和局部组件</title>
</head>
<body>
    <div id="app">
        <my_cpn></my_cpn>
    </div>
</body>
<script src="../js/vue.js"></script>
<script>
    //1.创建组件构造对象
    const cpnc = Vue.extend({
        template: `
            <div>
                <h2>标题</h2>
                <p>段落1</p>
                <p>段落2</p>
            </div>
        `,
    })

    //1.注册组件(全局组件，可以在多个Vue实例下使用)
    //Vue.component('my-cpn',cpnc);

    const app = new Vue({
        el: '#app',
        data: {
            message: 'hello',
        },
        methods: {

        },
        //注册局部组件
        components: {
            my_cpn: cpnc
        }
    })
</script>
</html>